home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9405 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: surfnet.nl!sun4nl!xs4all!falstaff
  2. From: falstaff@xs4all.nl (Falstaff)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Problem with Watcom C++ 10.5
  5. Date: 10 Mar 1996 09:07:43 GMT
  6. Organization: XS4ALL, networking for the masses
  7. Message-ID: <4hu64v$60u@news.xs4all.nl>
  8. References: <31426ACB.6AA1@scsn.net>
  9. NNTP-Posting-Host: xs1.xs4all.nl
  10. X-Newsreader: NN version 6.5.0 #666 (NOV)
  11.  
  12. Michael <mdorsey@scsn.net> writes:
  13.  
  14. >I'm having a rather strange problem with Watcom C.  When using functions
  15. >that output to stdout (ie printf()), it is not flushing to the screen
  16. >until a newline is sent.  For example:
  17.  
  18. >void main(void)
  19. >{
  20. >  printf("Hit Y for yes, N for no: ");
  21. >  yn();
  22. >}
  23.  
  24. >yn() gets the key stroke and prints yes or no.  The problem is that the
  25. >statement will not be printed until the newline from the answer is sent.
  26.  
  27. Yup, that's normal for many libraries.  Buffering is there for you, to
  28. make the program faster.
  29.  
  30. >Kind of hard to answer a question if you can't see it.  I can get around
  31. >it by flushing stdout after printf(), but I was kind of hoping there was
  32. >some type of variable I could set to turn off buffering of stdout.
  33.  
  34. How about setvbuf()?  See K&R p. 243.
  35.  
  36. Frank
  37. --
  38. The famous GIICM now on line:  http://www.xs4all.nl/~falstaff/GIICM.html
  39. ------------------------------------------------------------------------
  40. Frank A. Vorstenbosch        +31-(70)-355 5241        falstaff@xs4all.nl
  41.